import { createRouter, RouteRecordRaw, createWebHistory }  from 'vue-router';
import LeftSidebar from '@/components/LeftSidebar/index.vue';
import Container from '@/components/Container/index.vue';

export const constantRoutes: Array<RouteRecordRaw> = [
  {
      path: '/login',
      name: 'login',
      component: () => import('@/pages/login/index.vue')
  },
  {
      path: '/404',
      name: '404',
      component: () => import('@/pages/error-page/404.vue'),
  },
  {
      path: '/401',
      name: '401',
      component: () => import('@/pages/error-page/401.vue'),
  },
  {
    path: '/',
    components: {
      LeftSidebar,
      Container
    },
    children: [
      {
        path: 'welcome',
        name: 'welcome',
        component: () => import('@/pages/welcome/index.vue'),
        meta: {
          icon: 'icon-huanyingci1'
        }
      },
      {
        path: 'account',
        name: 'account',
        component: () => import('@/pages/account/index.vue'),
        meta: {
          icon: 'icon-gerenzhongxin-zhong'
        },
      }
    ]
  }
]

const router = createRouter({
    history: createWebHistory(),
    routes: constantRoutes
});

export default router;